<!-- Phan khai bao bien cuc bo-->
<?php

/************************************************
* Updated by Dinh, Nguyen			*
* Content: Fix not show record  		*
* Reason: Mistake in separate page function 	*
* Date: 25/06/2007				*
************************************************/

$v_staff_id =  $_SESSION['staff_id'];
if(isset($_REQUEST['fuseaction_back'])) {
	$fuseaction_back=$_REQUEST['fuseaction_back'];
}else{
	$fuseaction_back = $fuseaction;
}
$v_page=1;
if(isset($_REQUEST['hdn_page'])){
	$v_page=intval($_REQUEST['hdn_page']);
}
$v_goto_url = "index.php";
$v_current_style_name = "round_row";
//$v_receiver_id = _get_item_attr_by_id ($_SESSION['arr_all_staff'],$_SESSION['staff_id'],'id');
$v_count = sizeof($arr_all_record);
#echo  $v_count;
//file dinh dang bang hien thi danh sach ho so da tiep nhan
$v_table_struct_xml_file = "../../xml/".$v_recordtype_filter."/danh_sach_ho_so_da_tiep_nhan_qua_mang.xml";
if (file_exists($v_table_struct_xml_file)){
	$v_table_struct_xml_string = _read_file($v_table_struct_xml_file);
	
}else{
	$v_table_struct_xml_file = "../../xml/other/danh_sach_ho_so_da_tiep_nhan_qua_mang.xml";
	$v_table_struct_xml_string = _read_file($v_table_struct_xml_file);
}

$table_struct_rax = new RAX(); 
$table_struct_rec = new RAX(); 
$table_struct_rax->open($v_table_struct_xml_string);
$table_struct_rax->record_delim = 'col';
$table_struct_rax->parse();
$table_struct_rec = $table_struct_rax->readRecord(); 
?>
<!--bang chua tieu de cua form-->
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="normal_title">
		<td><?php echo $v_title; ?>
			<a id="goto" href="" style=".color:white">#</a>
		</td>
	</tr>
</table>
<!-- bang chua cac tieu thuc loc-->
<table cellpadding="0" cellspacing="0" width="100%" border="0">
	<col width="20%"><col width="30%"><col width="50%">
	<!--form chinh-->
		<form action="index.php" name="f_dsp_all_record" method="post">
		<input type="hidden" name="fuseaction" value="DISPLAY_ALL_RECORD">
		<input type="hidden" name="fuseaction_back" value="<?php echo $fuseaction_back; ?>">
		<input type="hidden" name="hdn_record_id" value="<?php echo $v_record_id; ?>">
		<input type="hidden" name="hdn_record_id_list" value="">
		<input type="hidden" name="hdn_worktype" value="<?php echo $v_worktype; ?>">
		<input type="hidden" name="hdn_recordtype_filter" value="<?php echo $v_recordtype_filter; ?>">
		<input type="hidden" name="hdn_received_date_filter" value="<?php echo $v_receive_date_filter; ?>">
		<input type="hidden" name="hdn_page" value="<?php echo $v_page?>">
	<tr><td height="5"></td></tr>
	<tr>
		<td class="normal_label" align="left"><?php echo CONST_RECORD_TYPE_LABEL;?>&nbsp;</td>
		<td colspan="2">
			<select class="normal_selectbox" name="sel_recordtype" style="width:500px" optional="<?php echo CONST_RECORD_TYPE_OPTIONAL; ?>" message = "<?php echo CONST_CATE_MESSAGE; ?>" onChange="onchange_submit(this,document.forms(0).hdn_recordtype_filter,'<?php echo $fuseaction;?>');">
              <?php echo _generate_select_option($arr_all_recordtype,'0','0','1', $v_recordtype_filter);?>
          </select>
		</td>
	</tr><?php
	if ($v_show_date){?>
	<tr>
		<td align="left" class="normal_label"><?php echo CONST_RECORD_DATE_FILTER_LABEL;?>
		</td>
		<td>
			<input type="text" name="txt_received_date" class="normal_date_textbox" isdate = "true" optional="<?php echo CONST_RECORD_DATE_FILTER_OPTIONAL; ?>" message = "<?php echo CONST_RECORD_DATE_FILTER_MESSAGE; ?>" value="<?php echo $v_receive_date_filter; ?>" onKeyDown="txt_filter_keydown();change_focus(document.forms(0),this);">
			<img src="<? echo $_ISA_IMAGE_URL_PATH;?>calendar.gif" border="0" onclick="DoCal('<?php echo $_ISA_LIB_URL_PATH; ?>isa-calendar/',document.forms(0).txt_received_date);onchange_submit(document.forms(0).txt_received_date,document.forms(0).hdn_received_date_filter,'DISPLAY_ALL_RECORD');" style="cursor:hand;">
			<input type="hidden" name="btn_filter" class="normal_date_textbox" onClick="onchange_submit(document.forms(0).txt_received_date,document.forms(0).hdn_received_date_filter,'<?php echo $fuseaction;?>');">
		</td>		
	</tr><?php
	}?>		
</table>
<?php
$v_html_string = '';
$v_html_string = $v_html_string  . '<form action="index.php" method="post" name="f_dsp_all_record">';
$v_html_string = $v_html_string  . '<table class="list_table2" width="100%" cellpadding="0" cellspacing="0">';
$v_html_temp_width = '';
$v_html_temp_label = '';
$v_column = 0;
while ($table_struct_rec) { 
	$table_struct_row = $table_struct_rec->getRow();
	$v_label = $table_struct_row["label"];
	$v_width = $table_struct_row["width"];
	$v_html_temp_width = $v_html_temp_width  . '<col width="'.$v_width .'">';
	$v_html_temp_label = $v_html_temp_label . '<td align="center">'.$v_label.'</td>';
	$table_struct_rec = $table_struct_rax->readRecord();
	$v_column ++;
}
$v_html_string = $v_html_string  . $v_html_temp_width;
$v_html_string = $v_html_string  . '<tr class="header">';
$v_html_string = $v_html_string  . $v_html_temp_label;
$v_html_string = $v_html_string  . '</tr></table>';
$v_html_string = $v_html_string  . '<div style="overflow: auto; width: 100%; height:'._CONST_HEIGHT_OF_LIST.';padding-left:0px;margin:0px">';
$v_html_string = $v_html_string  . '<table class="list_table2" width="100%" cellpadding="0" cellspacing="0">';
$v_html_string = $v_html_string  . $v_html_temp_width;
	if ($v_count >0){
		for($row_index = 0;$row_index< $v_count ;$row_index++){
			$v_url = "";
			$v_received_record_xml_data = $arr_all_record[$row_index]['C_RECEIVED_RECORD_XML_DATA'];
			//echo htmlspecialchars($v_received_record_xml_data);
			if ($v_current_style_name == "odd_row"){
				$v_current_style_name = "round_row";
			}else{
				$v_current_style_name = "odd_row";
			}
			$v_html_string = $v_html_string  .'<tr class="'.$v_current_style_name.'" >'; 

			$table_struct_rax = new RAX(); 
			$table_struct_rec = new RAX(); 
			$table_struct_rax->open($v_table_struct_xml_string);
			$table_struct_rax->record_delim = 'col';
			$table_struct_rax->parse();
			$table_struct_rec = $table_struct_rax->readRecord(); 
			while ($table_struct_rec) { 
				$table_struct_row = $table_struct_rec->getRow();
				$v_type = $table_struct_row["type"];
				$v_width = $table_struct_row["width"];
				$v_align = $table_struct_row["align"];
				$v_xml_data = $table_struct_row["xml_data"];
				$v_column_name = $table_struct_row["column_name"];
				$v_xml_tag_in_db = $table_struct_row["xml_tag_in_db"];
				$v_php_function = $table_struct_row["php_function"];
				if ($v_xml_data=="true"){
					$column_rax = new RAX(); 
					$column_rec = new RAX();
					$column_rax->open($v_received_record_xml_data);
					$column_rax->record_delim = 'data_list';
					$column_rax->parse();
					$column_rec = $column_rax->readRecord(); 
					$column_row = $column_rec->getRow();
					$v_value = _restore_XML_bad_char($column_row[$v_xml_tag_in_db]);
					$v_html_string = $v_html_string  . Element_Type($v_type); 
				}else{
					$v_value = $arr_all_record[$row_index][$v_column_name];
					if ($v_type=="checkbox"){
						$v_value_id = $arr_all_record[$row_index][$v_column_name];
						$v_url = "row_onclick(" . "document.forms(0).hdn_record_id"  . "," . $v_value_id . "," . "'".$v_fuseaction_onclick."','" . $v_goto_url . "')";
					}
					$v_html_string = $v_html_string  . Element_Type($v_type); 
				}
				$table_struct_rec = $table_struct_rax->readRecord();
			}
			$v_html_string = $v_html_string  .'</tr>';
		}
	}
	if ($v_current_style_name == "odd_row"){
		$v_next_style_name = "round_row";
	}else{
		$v_next_style_name = "odd_row";
	}
$v_html_string = $v_html_string  . _add_empty_row($v_count,_CONST_NUMBER_OF_ROW_PER_LIST,$v_current_style_name,$v_next_style_name,$v_column);
$v_html_string = $v_html_string  .'</table></div>';
echo $v_html_string;

?>
<table width="100%" cellpadding="0" border="0">
	<tr>
	  	<td align="left" colspan = "2" class="small_label">
	  		<small class="small_starmark"><?php echo CONST_RECORD_COUNT_LIST_LABEL1 . $v_count . CONST_RECORD_COUNT_LIST_LABEL2;?></small>
	  	</td>
		<td class="normal_link" align="right"><?php
			/*if ($v_count >0){
				echo PageBreak($v_count,$v_page,10,_CONST_NUMBER_OF_ROW_PER_LIST);
			}*/?>
		</td>
	</tr>
</table>

</div id="hotkey">
</form> 
<script>
	document.all.goto.href="#<? echo $v_current_item_id;?>";
	document.all.goto.click();
</script>	
